<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>缴费</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<style>
    .new_tanchuang{
		background:#fff;
		border-radius: 10px;
	}
	.new_tanchuang .titleee{
		padding:20px;
		width: 100%;
		box-sizing: border-box;
		text-align: center;
		color:#fff;
		background:#3b79e3;
		border-radius: 10px;
		font-size: 18px;
		font-weight: bold;
	}
	.new_tanchuang .tanchuang_con{
		padding:15px;
		box-sizing: border-box;
	}
	.new_list .new_list_li{
		display: flex;
		color:#798ca0;
		line-height: 25px;
		font-size: 16px
	}
	.new_list .new_list_li .list_title{
		color: #6581b9;
		padding-right: 10px
	}
	.new_list{
		width: 100%;
		padding-bottom: 15px;
		border-bottom:2px dashed #ccc;
	}
	.new_cont{
		margin-top: 10px;
		display: flex;
	}
	.new_cont .new_cont_left{
		background:#f1f3f7;
		width: 65%;
		    padding-bottom: 18px;
	}
	.new_cont .new_cont_right{
		width: 35%;
		border:1px solid #ccc;
	}
	.new_cont .new_cont_right .chenggong{
	    text-align: center;
	    margin-top:120px;
	    font-size: 16px;
	    margin-left: 35px;
	}
	.new_cont_left_biaoti{
		padding:5px 20px;
		box-sizing: border-box;
		font-size: 16px;
		font-weight: bold;
		text-align: center;
		color:#fff;
		background:#3b79e3;
		border-radius: 2px 20px 20px 2px;
		display: inline-block;
	}
	.new_cont_left .new_cont_list{
		display: flex;
		flex-wrap: wrap;
		padding: 10px;
    	box-sizing: border-box;
    	border-bottom: 1px solid #ccc
	}
	.new_cont_left .new_cont_list .new_cont_list_li{
		width: 33%;
		font-size: 16px;
		margin-bottom: 10px;
		line-height: 25px;

	}
	.new_cont_left .new_cont_list .new_cont_list_li .tt{
		color: #798ca0
	}
	.new_cont_left .new_cont_list .new_cont_list_li .ed{
		color: #6581b9;
	}
	.new_cont_left .heji{
		color: #798ca0;
		font-size: 16px;
		padding: 10px;
		text-align:left;
	}
	.new_cont_left .heji span{
		color:#ff4400;
		font-size: 20px;
		font-weight: bold;
	}
	.new_cont_right .erweima{
		width: 150px;
		height: 150px;
		background:red;
	    margin: 0 auto;
	    margin-top:8%;
	}
	.new_cont_right .erweima img{
		width: 100%;
		height: 100%
	}
	.new_cont_right .zhifutype{
		display: flex;
		justify-content: center;
	}
	.new_cont_right .zhifutype img{
		display: block;
		margin: 15px
	}
	.tanchuang_con .time{
		text-align: center;
		font-weight: bold;
		font-size: 16px;
		color: #798ca0;
		padding:20px;
	}
	.tanchuang_con .time span{
		color:#ff4400;
		font-weight: bold;
	}
</style>
<style>
    .new_table{
        margin:0 auto;
        width: 50%;
    }
    .new_table td{
        width:100px;
        padding:10px;
        box-sizing: border-box;
        text-align: center;
    }
</style>
<style type="text/css">
    .tablist .new_tabqie{
        height:30px;
        line-height: 30px;
        box-sizing: border-box;
        margin-right:40px;
        cursor: pointer;
    }
    .new_tabqie.active{
        color:blue;
        border-bottom: 1px solid blue;
        box-sizing: border-box;
    }
    #ii{
    position: absolute;
        left: 35%;
    top: 10px;
    background: blue;
    color: #fff;
    padding: 5px 10px;
    border-radius: 8px;
}
</style>
<style type="text/css" media="all">
    .model{
        background:rgba(0,0,0,0.5);
        position: fixed;
        left: 0;
        top:0;
        width:100%;
        height:100%;
        z-index: 1;
        display: none;
            text-align: center;
    padding-top: 200px;
        
    }
    .model .close{
        background:blue;
        color:#fff;
        padding:5px 10px;
        border-radius: 10px;
        display: inline-block;
    margin-top: 22px;
    }
    #imgg{
          position: relative;
        z-index: 99;
        width:350px;
    }
    .paytype{
    	text-align: center;
    	padding:30px 0;
    	margin-top:30px
    }
</style>
<body>
<div id="ii">点击生成图片</div>
<div class="paytype">支付渠道：<span id="paytypes"></span></div>
<div style=" margin-left:-260px;margin-top:-160px">

	  <div id="baojiadan" class="modal-dialog" style="width:900px!important;padding:30px;box-sizing: border-box;transform:scale(0.38);">
        <div class="modal-content">
            <div class="modal-header">
            	<div class="new_tanchuang">
                	<div class="titleee">茗延安全服务有限公司</div>
                	<div class="tanchuang_con">
                		<div class="new_list">
                			<div class="new_list_li"><div class="list_title">服务单号:</div><span id="newjiao_bianhao">df12524154</span></div>
                			<div class="new_list_li"><div class="list_title">车牌号码:</div><span id="newjiao_pai">川ADD8998</span></div>
                			<div class="new_list_li"><div class="list_title namee" >被服务人:</div><span id="newjiao_name">钟杰</span></div>
                		</div>
                		<div class="new_cont">
                			<div class="new_cont_left">
                				<div class="new_cont_left_biaoti">服务项目</div>
                				<div class="new_cont_list" id="fuwuxm">
                					<div class="new_cont_list_li">
                						<div class="tt">机动车车损服务</div>
                						<div class="tt">1340.33</div>
                						<div class="ed">额度:100万</div>
                					</div>
                					<div class="new_cont_list_li">
                						<div class="tt">机动车第三者责任服务</div>
                						<div class="tt">1340.33</div>
                						<div class="ed">额度:100万</div>
                					</div>
                					<div class="new_cont_list_li">
                						<div class="tt">车上人员责任服务(司机)</div>
                						<div class="tt">1340.33</div>
                						<div class="ed">额度:100万</div>
                					</div>
                					<div class="new_cont_list_li">
                						<div class="tt">标准服务费</div>
                						<div class="tt">1340.33</div>
                						<div class="ed">额度:100万</div>
                					</div>
                				</div>
                				<div class="heji">合计支付: <span >￥<text id="newjiao_money">3216.26</text></span></div>
                			</div>
                			<div class="new_cont_right">
                			    <div id="newerweimak">
                			        <div class="erweima" id="newerweima"><img src="" alt=""></div>
                				    <div class="zhifutype">
                				        <img src="../weixin.png" alt="">
                				        <!--<img src="/zhifubao.png" id="zhifu_tubiao" alt="">-->
                				    </div>
                			    </div>
                				<div class="chenggong" id="newjiaofei_success">
                				    <div class="cont_list"><div class="zhifu_tt" style="color:#6581b9">支付方式：</div><div id="newjiaofei_fangshi" style="color:#798ca0" >2022-12-11</div></div>
						            <div class="cont_list"><div class="zhifu_tt" style="color:#6581b9">支付时间：</div><div id="newjiaofei_time" style="color:#798ca0">12</div></div>
                				</div>
                			</div>
                		</div>
                		<div class="time new_zhifu_timess">请在 <span id="new_zhifu_times">2023-09-04 23:59:59</span>前进行扫码支付</div>
                	</div>
                </div>
            </div>

        </div>
    </div>
    </div>
    <div class="model">
		<div>
		    <img id="imgg" src="" alt="" mode="widthFix">
		</div>
		<div style="color:red">
		    长按图片保存
		</div>
		<div class="close" id="close_model">
		    关闭
		</div>
		    
	</div>
</body>
<script src="html2canvas.min.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery-3.2.1.min.js">
    
</script>
<script>
	var dianji=document.getElementById("ii")
		console.log(dianji)
		dianji.addEventListener('click',function(){
			console.log(12121)
		
			html2canvas(document.querySelector("#baojiadan")).then(canvas => {
			    // 将canvas转换为图片
			    const imgData = canvas.toDataURL('image/png');
			    // 创建一个新的a元素并模拟点击以保存图片
			    const link = document.createElement('a');
			    link.download = 'baojiadan.png';
			    link.href = imgData;
			 //   var pp=document.getElementById("pp")
			 //   pp.href=imgData
			    	    // link.click();
			 //   window.postMessage({ type: 'download', url: imgData });
		
			    
				var imgg=document.getElementById("imgg")
				imgg.src=imgData
				var model=document.querySelector(".model")
				model.style.display='block'
				// console.log(imgData)
			});
		})
	var closee=document.getElementById("close_model")	
	
			closee.addEventListener('click',function(){
			    var model=document.querySelector(".model")
				model.style.display='none'
			})
window.onload = function() {
    console.log('页面加载完成');
    // 在这里写你的代码
    // 假设当前URL是 http://example.com/?name=John&age=30
const urlParams = new URLSearchParams(window.location.search);
const id = urlParams.get('id'); // 获取id参数的值
const token = urlParams.get('token'); // 获取id参数的值
const channel_id = urlParams.get('channel_id'); // 获取id参数的值
console.log(id,token,channel_id);
 getdata(id,token,channel_id)
 
}
function getdata(id,token,channel_id){
	 var data={'id':id,"token":token,"channel_id":channel_id}
        $.ajax({
			url:"https://tc.niutuwangluo.com/api/index/pay_rwm",
			dataType:'json',
			type:'post',
			data:data,
			success:function (res) {
				console.log(res)
				$("#paytypes").html(res.data.channel)
				 if (res.data.chezhu == 2) {
                        $("#bb").attr('checked', 'true');
                        $(".namee").html('车主姓名:')
                    } else {
                        $("#aa").attr('checked', 'true');
                        $(".namee").html('被服务人')
                    }
                    if (res.data.tcxm == 2) {
                        $("input[name='newxiangmu1']").prop("checked", true);
                    } else {
                        $("input[name='newxiangmu1']").prop("checked", false);
                    }
                    if (res.data.tk_type == 1) {
                        $("input[name='newtiaokuan']").prop("checked", true);
                    } else {
                        $("input[name='newtiaokuan']").prop("checked", false);
                    }
                    if (res.data.bjt == 1) {
                        $("input[name='beijingtu']").prop("checked", true);
                    } else {
                        $("input[name='beijingtu']").prop("checked", false);
                    }

                    var vall = res.data.er
                    $("#newerweimak").show()
                    $("#newerweima").html("<img src=" + vall + " style='width:160px;height:160px;'/>")
                    $(".new_zhifu_timess").show()
                    $("#new_zhifu_times").html(res.data.times)
                    $("#new_qiehuan").css("display", 'flex')

                    $("#newjiao_name").html(res.data.learned_name)//车主姓名
                    $("#newjiao_pai").html(res.data.car_num)//车牌号码
                    $("#newjiao_jia").html(res.data.car_vin)//车架号
                    $("#newjiao_money").html(res.data.main_free)//订单金额
                    // $("#newjiao_bianhao").html(res.data.new_zf.req_seq_id)//编号
                    $("#newjiao_bianhao").html(res.data.tong_storage)//编号


                    var tongchou = ''
                    if (res.data.main_name == 1) {
                     
                        tongchou +=
                         
                            `<div class="new_cont_list_li">
                						<div class="tt">机动车车损损失</div>
                						<div class="tt">` + res.data.main_standard + `</div>
                						<div class="ed">额度:` + res.data.main_money + `</div>
                					</div>`
                    }
                    //机动车第三者责任服务
                    if (res.data.main_santong == 3000000) {
                        var main_santong = '300万'
                    } else if (res.data.main_santong == 2000000) {
                        var main_santong = '200万'
                    } else if (res.data.main_santong == 1500000) {
                        var main_santong = '150万'
                    } else if (res.data.main_santong == 1000000) {
                        var main_santong = '100万'
                    } else if (res.data.main_santong == 500000) {
                        var main_santong = '50万'
                    } else if (res.data.main_santong == 300000) {
                        var main_santong = '30万'
                    } else if (res.data.main_santong == 200000) {
                        var main_santong = '20万'
                    } else if (res.data.main_santong == 100000) {
                        var main_santong = '10万'
                    } else if (res.data.main_santong == 50000) {
                        var main_santong = '5万'
                    }
                    if (res.data.main_disan == 1) {
                   
                        tongchou +=
                      
                            `<div class="new_cont_list_li">
                						<div class="tt">机动车第三者责任</div>
                						<div class="tt">` + res.data.main_biao + `</div>
                						<div class="ed">额度:` + main_santong + `</div>
                					</div>`
                    }

                    //车上人员责任服务(司机)
                    if (res.data.siji_tong == 10000) {
                        var siji_tong = '1万'
                    } else if (res.data.siji_tong == 20000) {
                        var siji_tong = '2万'
                    } else if (res.data.siji_tong == 30000) {
                        var siji_tong = '3万'
                    } else if (res.data.siji_tong == 40000) {
                        var siji_tong = '4万'
                    } else if (res.data.siji_tong == 50000) {
                        var siji_tong = '5万'
                    } else if (res.data.siji_tong == 60000) {
                        var siji_tong = '6万'
                    } else if (res.data.siji_tong == 70000) {
                        var siji_tong = '7万'
                    } else if (res.data.siji_tong == 80000) {
                        var siji_tong = '8万'
                    } else if (res.data.siji_tong == 90000) {
                        var siji_tong = '9万'
                    } else if (res.data.siji_tong == 100000) {
                        var siji_tong = '10万'
                    } else if (res.data.siji_tong == 200000) {
                        var siji_tong = '20万'
                    } else if (res.data.siji_tong == 300000) {
                        var siji_tong = '30万'
                    } else if (res.data.siji_tong == 500000) {
                        var siji_tong = '50万'
                    }
                    if (res.data.siji == 1) {
                    
                        tongchou +=
                          
                            `<div class="new_cont_list_li">
                						<div class="tt">机动车车上人员-司机</div>
                						<div class="tt">` + res.data.siji_biao + `</div>
                						<div class="ed">额度:` + res.data.siji_tong + `</div>
                					</div>`
                    }
                    //车上人员责任保险(乘客)
                    if (res.data.ck_money == 10000) {
                        var ck_money = '1万'
                    } else if (res.data.ck_money == 20000) {
                        var ck_money = '2万'
                    } else if (res.data.ck_money == 30000) {
                        var ck_money = '3万'
                    } else if (res.data.ck_money == 40000) {
                        var ck_money = '4万'
                    } else if (res.data.ck_money == 50000) {
                        var ck_money = '5万'
                    } else if (res.data.ck_money == 60000) {
                        var ck_money = '6万'
                    } else if (res.data.ck_money == 70000) {
                        var ck_money = '7万'
                    } else if (res.data.ck_money == 80000) {
                        var ck_money = '8万'
                    } else if (res.data.ck_money == 90000) {
                        var ck_money = '9万'
                    } else if (res.data.ck_money == 100000) {
                        var ck_money = '10万'
                    } else if (res.data.ck_money == 200000) {
                        var ck_money = '20万'
                    }
                    if (res.data.chengke == 1) {
                      
                        tongchou +=
                         
                            `<div class="new_cont_list_li">
                						<div class="tt">机动车车上人员-乘客` + ck_money + `元/座` + res.data.chengke_zuo + `座</div>
                						<div class="tt">` + res.data.ck_biao + `</div>
                						<div class="ed">额度:` + res.data.ck_tong + `</div>
                					</div>`
                    }


                    //自燃损失服务
                    if (res.data.ziran == 1) {
                     
                        tongchou +=
                           
                            `<div class="new_cont_list_li">
                						<div class="tt">` + res.data.ziran_c + `</div>
                						<div class="tt">` + res.data.zi_biao + `</div>
                						<div class="ed">额度:` + res.data.zi_tong + `</div>
                					</div>`
                    }
                    //发动机涉水损失服务
                    if (res.data.fdjsunshi == 1) {
                      
                        tongchou +=
                        
                            `<div class="new_cont_list_li">
                						<div class="tt">` + res.data.fd_c + `</div>
                						<div class="tt">` + res.data.fdj_biao + `</div>
                						<div class="ed">额度:` + res.data.fdj_tong + `</div>
                					</div>`
                    }
                    //指定修理厂服务
                    if (res.data.zdxiuli == 1) {
                        
                        tongchou +=
                           
                            `<div class="new_cont_list_li">
                						<div class="tt">` + res.data.zd_c + `</div>
                						<div class="tt">` + res.data.zd_biao + `</div>
                						<div class="ed">额度:` + res.data.zd_tong + `</div>
                					</div>`
                    }
                    //车上货物责任服务	
                    if (res.data.huowu == 1) {
                      
                        tongchou +=
                        
                            `<div class="new_cont_list_li">
                						<div class="tt">` + res.data.huowu_c + `</div>
                						<div class="tt">` + res.data.hw_biao + `</div>
                						<div class="ed">额度:` + res.data.hw_tong + `</div>
                					</div>`
                    }
                    //玻璃单独破碎服务
                    if (res.data.boli == 1) {
                      
                        tongchou +=
                        
                            `<div class="new_cont_list_li">
                						<div class="tt">` + res.data.boli_c + `</div>
                						<div class="tt">` + res.data.bl_biao + `</div>
                						<div class="ed">额度:` + res.data.bl_tong + `</div>
                					</div>`
                    }
                    //不计免赔服务
                    if (res.data.buji == 1) {
                      
                        tongchou +=
                       
                            `<div class="new_cont_list_li">
                						<div class="tt">不计免赔服务</div>
                						<div class="tt">` + res.data.bu_biao + `</div>
                						<div class="ed">额度:` + res.data.bu_tong + `</div>
                					</div>`
                    }


                    if (res.data.dao_tong == 3000000) {
                        var dao_tong = '300万'
                    } else if (res.data.dao_tong == 2000000) {
                        var dao_tong = '200万'
                    } else if (res.data.dao_tong == 1500000) {
                        var dao_tong = '150万'
                    } else if (res.data.dao_tong == 1000000) {
                        var dao_tong = '100万'
                    } else if (res.data.dao_tong == 500000) {
                        var dao_tong = '50万'
                    } else if (res.data.dao_tong == 300000) {
                        var dao_tong = '30万'
                    } else if (res.data.dao_tong == 200000) {
                        var dao_tong = '20万'
                    } else if (res.data.dao_tong == 100000) {
                        var dao_tong = '10万'
                    } else if (res.data.dao_tong == 50000) {
                        var dao_tong = '5万'
                    } else {
                        var dao_tong = '-'
                    }
                    //三者医保外用药
                    if (res.data.dao_name == 1) {
                    
                        tongchou +=
                        

                            `<div class="new_cont_list_li">
                						<div class="tt">三者医保外用药</div>
                						<div class="tt">` + res.data.dao_biao + `</div>
                						<div class="ed">额度:` + res.data.dao_tong + `</div>
                					</div>`
                    }

                    $("#fuwuxm").html(tongchou)
                    if (res.data.status == 5) {

                        if (!res.data.jiaofei_time == '') {
                            if (res.data.new_zf) {
                                var type = '扫码'
                                $("#jiao_bianhao").html(res.data.new_zf.req_seq_id)//编号
                            } else {
                                if (res.data.jiaofei_type == 1) {
                                    var type = '微信'
                                } else {
                                    var type = '支付宝'
                                }
                                $("#jiao_bianhao").html(res.data.tong_storage)//编号
                            }
                            $("#newjiaofei_fangshi").html(type)//支付方式
                            $("#newjiaofei_time").html(res.data.jiaofei_time)//支付时间
                        } else {
                            $("#newjiaofei_fangshi").html('其他')//支付方式
                            $("#newjiaofei_time").html('')//支付时间
                        }
                        $(".new_table").hide()
                        $("#newjiaofei_success").show()
                        $("#newerweima").hide()
                        $("#newerweimak").hide()
                        $(".new_zhifu_timess").hide()
                        $("#new_qiehuan").hide()
                    } else {
                        $("#newjiaofei_success").hide()
                        $(".new_table").show()
                        $("#newerweima").show()
                        $("#newerweimak").show()
                        $(".new_zhifu_timess").show()
                        $("#new_zhifu_times").html(res.data.times)
                        $("#new_qiehuan").css("display", 'flex')
                    }


			     var vall=res.data.er
			      $("#newerweimak").show()
    				$("#newerweima").html("<img src="+vall+" style='width:160px;height:160px;'/>")
    				$(".new_zhifu_timess").show()
                    $("#new_zhifu_times").html(res.data.times)
    				
    				$("#newjiao_name").html(res.data.learned_name)//车主姓名
    				$("#newjiao_pai").html(res.data.car_num)//车牌号码
    				$("#newjiao_jia").html(res.data.car_vin)//车架号
    				$("#newjiao_money").html(res.data.main_free)//订单金额
    				// $("#newjiao_bianhao").html(res.data.new_zf.req_seq_id)//编号
    				$("#newjiao_bianhao").html(res.data.tong_storage)//编号
    				
			}
        })
}
</script>
</html>